package com.example.dto;

import com.example.domain.Dish;
import com.example.domain.other.DishFlavor;
import lombok.Data;

import java.io.Serializable;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.List;

@Data
public class DishDto{
    private Long id;
    private String name;   //菜品名称
    private Long categoryId;    //菜品分类id
    private BigDecimal price;  //菜品价格
    private String code;  //商品码
    private String image;  //图片
    private String description;   //描述信息
    private Integer status;  //0 停售 1 起售
    private Integer sort;  //顺序

    private List<String> flavors = new ArrayList<>();   //菜品口味

    public Dish gainDish(){
        Dish dish=new Dish();
        dish.setId(this.id);
        dish.setName(this.name);
        dish.setCategoryId(this.categoryId);
        dish.setPrice(this.price);
        dish.setCode(this.code);
        dish.setImage(this.image);
        dish.setDescription(this.description);
        dish.setStatus(this.status);
        dish.setSort(this.sort);
        return dish;
    }
    public DishFlavor gainDishFlavor(){
        DishFlavor dishFlavor=new DishFlavor();
        dishFlavor.setDishId(this.id);
        dishFlavor.setName("默认");
        dishFlavor.setValue(this.flavors.toString());
        return dishFlavor;
    }
}
